using ProjectBase.Data;
using ProjectBase.Utils;
using Clanta.Core.DataInterfaces;
using Clanta.Core.Domain;

namespace Clanta.Data
{
    /// <summary>
    /// Exposes access to NHibernate DAO classes.  Motivation for this DAO
    /// framework can be found at http://www.hibernate.org/328.html.
    /// </summary>
    public class NHibernateDaoFactory : IDaoFactory
    {
        private string sessionFactoryConfigPath;

        public NHibernateDaoFactory(string sessionFactoryConfigPath)
        {
            Check.Require(sessionFactoryConfigPath != null, "sessionFactoryConfigPath may not be null");
            SessionFactoryConfigPath = sessionFactoryConfigPath;
        }

        protected string SessionFactoryConfigPath
        {
            get { return sessionFactoryConfigPath; }
            set { sessionFactoryConfigPath = value; }
        }

        public IConferenceDao ConferenceDao
        {
            get { return new ConferenceDao(sessionFactoryConfigPath); }
        }

        public ICustomerDao CustomerDao
        {
            get { return new CustomerDao(sessionFactoryConfigPath); }
        }

        public IPresentationDao PresentationDao
        {
            get { return new PresentationDao(sessionFactoryConfigPath); }
        }
    }
}
